

LuaPlayerHM version 2
	AKA
      LPHMv2

This is the new and redesigned version of LuaPlayerHM.

There are some major changes to the player.
	-It no longer uses graphics.c for it's graphics engine. But uses OSLib MOD from sayaka.
	-All of the LPHMDrivers are built into the LPHMv2 eboot.pbp and loaded automaticaly.
	-The Image functions are no longer are called with a ':' But with a '.' Except for image:width() and image:hight()
	-The screen functions are no longer are called with a ':' But with a '.'
	-The screen.print(x,y,TXT,size,color,glow color, PGF Font) uses IntraFont by BenHur. Call 17 in PGF Font for Japanese charactors.
	-Wav files can be loaded and played at the same time as MP3 and other formats.
	-All mod audio files are now supported. xm,mod ect...
	-To print to the screen of blit and image you must call screen.startDraw() and after your drawing screen.endDraw()
	-To flip screen call screen.flipscreen()
	-TTF font loading has been reincluded
	-Hold down Right and Left Triggers on booting LPHMv2 to enter the Recovery Console
	-Mp3 decoding is now done via the PSP's media decoder and uses the same functions as the PSP's music player. It also uses less CPU power.
	-Fixed Gameshare
	-Fixed Lots of other bugs.
	-Improved Graphics and Image.
	-Added new Image functions.
	-Added new screen functions.
	-Added the ability to draw to an image in Image.blit(), Image.fillRect() and Image.drawLine()
	-Fixed Recovery and Debuging USB error
	
Functions

####System functions##########
System.currentDirectory() With no vairable in the () it will return the current directory, else it will set the current directory.
System.listDirectory() Returns a list of the files in the directory.
System.createDirectory() Make a directory. Eg System.createDirectory("Ms0:/PSP/COOL") make the dir 'COOL'
System.removeDirectory() Delets a directory. Note the directory must be empty.
System.removeFile() Delets a file.
System.rename() Renames a file.
System.usbDiskModeActivate() Starts the USB connection.
System.usbDiskModeDeactivate() Ends the USB connection.
System.usbState() Returns the state of the USB. Eg isactive 1 or isconnected 2 , isestablished 3, 0 is nothing.
System.powerIsPowerOnline() Refer to old LuaPlayer Documents.  
System.powerIsBatteryExist()   Refer to old LuaPlayer Documents.       
System.powerIsBatteryCharging() Refer to old LuaPlayer Documents.       
System.powerGetBatteryChargingStatus() Refer to old LuaPlayer Documents. 
System.powerIsLowBattery() Refer to old LuaPlayer Documents.  
System.powerGetBatteryLifePercent() Refer to old LuaPlayer Documents.    
System.powerGetBatteryLifeTime()  Refer to old LuaPlayer Documents.      
System.powerGetBatteryTemp()  Refer to old LuaPlayer Documents.         
System.powerGetBatteryVolt()  Refer to old LuaPlayer Documents.         
System.powerTick() Refer to old LuaPlayer Documents.                   
System.md5sum()  Refer to old LuaPlayer Documents.                      
System.sioInit() Refer to old LuaPlayer Documents.                      
System.sioRead() Refer to old LuaPlayer Documents.                      
System.sioWrite()Refer to old LuaPlayer Documents.                       
System.irdaInit()Refer to old LuaPlayer Documents.                      
System.irdaRead() Refer to old LuaPlayer Documents.                  
System.irdaWrite() Refer to old LuaPlayer Documents.                   
System.sleep() Will put the Lua thread to sleep for the amount of milliseconds entered into the ().                        
System.getFreeMemory() Returns the amount of free memory.                
System.cfwVersion() Returns the CFW version                    
System.madeby() Displays a list of Developers that contribute to the LPHMv2                     
System.getModel() Returns the modle of the PSP. Eg 1000 for phat and 2000 for Slim.                   
System.getFreeSpace() Returns the Free space on a Device. Eg System.getFreeSpace("ms0:")                  
System.getTotalSize() Returns the Total space on a Device. Eg System.getFreeSpace("ms0:")                     
System.Quit() Exits the LPHMv2 imedently.										
System.setcpuspeed() Sets the speed of the CPU. 10 -> 333. Eg System.setcpuspeed(333)				
System.getCpuSpeed() Returns the speed of the CPU				
System.getBusSpeed() Returns the speed of the Bus				
System.runeboot() Starts a eboot.pbp file. Eg System.runeboot("ms0:\eboot.pbp")						
System.playerVer() Returns the current version of the LPHMv2						
System.unassign() Unassignes the flash. Eg System.unassign("flash0:")						
System.assign()	Assignes the flash in Read/Write mode. Eg System.unassign("flash0:")					
System.memclean() Performs a Memory clean.						
System.loadPrx() Loads a PRX file. Will automaticaly detect for Kernal or User mode. Returns the id of the prx.						
System.stopPRX() Stops a prx that is loaded from the id returnd from the loading of the prx.					
System.nickName() Returns the nickname of the PSP					
System.message() Draws a message using the PSP's dialog. Eg System.message("HEllo World",0). 1 is Yes/NO option and 0 is cancel only.						
System.buttonPressed() Returns the value of the button pressed from any of the PSP dialogs. 1=Yes,2=no,3=back,4=cancel.					
System.copyFile() Copies a file from one place to another. Eg System.copyFile("ms0:\PSP\test.txt","ms0:\test.txt",0). 0 for keep source file. 1 for delet source file.					
System.suspend() Suspends the PSP.					
System.shutdown() Shutsdown the PSP.					
System.startUMD() Starts a UMD.					
System.startUpdate() Starts an Update file. Same settings as System.runeboot().						
System.startISO() Starts an ISO. Same settings as System.runeboot().							
System.startOSK() Starts the Sony OSK. Eg. System.startOSK("Title of text, Input text").						
System.startPSX() Starts a PS1 game. Same settings as System.runeboot().						
System.getTime() Returns the time from the value entered. Only 1 Time call expected Eg hour = 1,minutes = 2 or seconds = 3 and microseconds = 4 and pm or am = 5.						
System.getDate() Returns the date from the value entered.Only 1 Time call expected Eg year = 1,month = 2 or day = 3						
System.getVram() Returns the amount of Vram left.					
System.startGameSave()	Make a save game file. Eg. System.startGameSave(TITLE,ID,SAVE NAME,DATA,icon path) 					
System.startGameLoad()	loads a save game and Returns the data. Eg. System.startGameLoad(ID,SAVE NAME)					
System.setBrightness()	Sets the brightness of the PSp screen. Eg System.setBrightness(50). 1->100					
System.getBrightness()	Returns the current brightness level.					
System.setVolume() Sets the PSP volume. Eg. System.setVolume(22) 1->30						
System.getVolume() Returns the PSP current volume.						
System.enableDisplay()	Enables the LCD.					
System.disableDisplay()	Disables the LCD.					
System.mute() 1=Enable mute,0= disable.	Mute the Volume of the PSP.					
System.homePopup() 1=Enable mute,0= disable. Enable/Disable the home button.											
System.doesDirExist() Checks to see if the directory exsists. Returns 1 for Yes and 0 for no.						
System.doesFileExist()	Checks to see if the file exsists. Returns 1 for Yes and 0 for no.					
System.getDirSize() returns the size of a directory.						
System.getFileSize() returns the size of a file.						
System.webbrowser() Starts the webbrowser. Look at old LPHM files.						
System.usbDevFlash0() Sets the Flash0: as the USB device 						
System.usbDevFlash1() Sets the Flash1: as the USB device						
System.usbDevFlash2() Sets the Flash2: as the USB device						
System.usbDevFlash3() Sets the Flash3: as the USB device						
System.usbDevUMD() Sets the UMD: as the USB device	

####COLOR FUNCTIONS#######
Color.new(r,g,b,a) Returns the color data. 

###HPRM FUNCTIONS######
Hprm.read() Reads the key pressed from the remote.  
Hprm.headphone() Returns 1 if there is a headphone, 0 for no.        
Hprm.remote() Returns 1 if there is a remote, 0 for no.        
Hprm.mic() Returns 1 if there is a mic, 0 for no.       

####UMD FUNCTIONS#####
UMD.init() Starts the UMD drive.    
UMD.term() Ends the UMD drive          
UMD.checkDisk()  Checks to see if there is a UMD. 1 for yes, 0 for no.    
UMD.getSize() Returns the size of the UMD.     

####Sound FUNCTIONS#####
Sound.load() Loads a sound file. Eg wave and mod ect... and returns the pointer for the sound.
sound:play() Plays a sound from the pointer returned from Sound.load()


NOTE: ALL OGG, MP3, AAC and AC3 files DO NOT RETURN POINTERS FROM THE LOAD. THUS ONLY ONE OF EACH TYPE CAN BE PLAYED AT A TIME.
###OGG FUNCTIONS#####
Ogg.load() Loads a Ogg file.	
Ogg.play() Plays the song.			
Ogg.stop() Stops the song.			
Ogg.eos() Returns 1 for EndOfSong and 0 for still playing.			
Ogg.gettime() Returns the current time of the song.			
Ogg.percent() Returns the current percent of the song.			
Ogg.pause() Pauses the song.			
Ogg.songTime() Returns the total time of the song			
Ogg.artist() Returns the artist of the song.			
Ogg.title() Returns the title of the song.			
Ogg.album() Returns the Album of the song		
Ogg.genre() Returns the genre of the song			
Ogg.year() Retuns the year of the song
Ogg.trackNumber() Returns the track number of the song		
Ogg.layer() Returns the Layer of the song. Eg 1,2 or 3			
Ogg.kbit() Returns the Kilibit rate of the song			
Ogg.mode() Returns the sound mode of the song. Eg MONO or STERIO			
Ogg.visL() Needs a number between 1-> infinity and will return a value unique to the song playing. Left channel				
Ogg.visR() Needs a number between 1-> infinity and will return a value unique to the song playing. Right Channel	
###Aac Functions#####
Aac.load() Loads a Aac file			
Aac.play() Plays the song.		
Aac.stop() Stops the song.			
Aac.eos() Returns 1 for EndOfSong and 0 for still playing.			
Aac.gettime() Returns the current time of the song.		
Aac.percent() Returns the current percent of the song.			
Aac.pause() Pauses the song.			
Aac.songTime() Returns the total time of the song			
Aac.artist() Returns the artist of the song.			
Aac.title() Returns the title of the song.			
Aac.album() Returns the Album of the song)			
Aac.genre() Returns the genre of the song			
Aac.year() Retuns the year of the song			
Aac.trackNumber() Returns the track number of the song			
Aac.layer() Returns the Layer of the song. Eg 1,2 or 3					
Aac.kbit() Returns the Kilibit rate of the song					
Aac.mode() Returns the sound mode of the song. Eg MONO or STERIO	

###Mp3 Functions#####
Mp3me.load()			
Mp3me.play() Plays the song.			
Mp3me.stop() Stops the song.			
Mp3me.eos() Returns 1 for EndOfSong and 0 for still playing.			
Mp3me.gettime() Returns the current time of the song.			
Mp3me.percent() Returns the current percent of the song.			
Mp3me.pause() Pauses the song.			
Mp3me.songTime() Returns the total time of the song			
Mp3me.artist() Returns the artist of the song.			
Mp3me.title() Returns the title of the song.			
Mp3me.album() Returns the Album of the song				
Mp3me.genre() Returns the genre of the song			
Mp3me.year() Retuns the year of the song			
Mp3me.trackNumber() Returns the track number of the song				
Mp3me.layer() Returns the Layer of the song. Eg 1,2 or 3					
Mp3me.kbit() Returns the Kilibit rate of the song					
Mp3me.mode() Returns the sound mode of the song. Eg MONO or STERIO				
Mp3me.setVolume() Set the volume of the MP3 file				
Mp3me.setRLVolume() Set the volume of the individual right and left channel.				
Mp3me.mute() 1 to mute the mp3. 0 to enable the sound.		
Mp3me.rawSongTime() Returns the total time of the song in seconds
Mp3me.rawTime() Returns the current time of the song in seconds							
Mp3me.visL() Needs a number between 1-> infinity and will return a value unique to the song playing. Left channel					
Mp3me.visR() Needs a number between 1-> infinity and will return a value unique to the song playing. Right Channel			
Mp3me.art() Requires a path for the saving of the Album art extracted from the song. Returns a 1 for a Jpg image and a 2 for a png image. 
		Eg isart = Mp3me.art("ms0:/Music/"..songname)
			if isart == 1 then
				albart = Image.load("ms0:/Music/"..artname..".jpg")
			end
			if isart == 2 then
				albart = Image.load("ms0:/Music/"..artname..".png")
			end				
Mp3me.setPos()	Sets the position of the mark for the song. 			
Mp3me.getPos()	Returns the current mark position of the song.
Mp3me.info() Requires the path of the song. Allows the use of the ID3 functions artist,title,genre,year,trackNumber,layer to be used with out loading a file.		
		
###Aa3 Functions#####
Aa3me.load()			
Aa3me.play() Plays the song.			
Aa3me.stop() Stops the song.				
Aa3me.eos() Returns 1 for EndOfSong and 0 for still playing.				
Aa3me.gettime() Returns the current time of the song.			
Aa3me.percent() Returns the current percent of the song.			
Aa3me.pause() Pauses the song.				
Aa3me.songTime() Returns the total time of the song				
Aa3me.artist() Returns the artist of the song.			
Aa3me.title() Returns the title of the song.			
Aa3me.album() Returns the Album of the song				
Aa3me.genre() Returns the genre of the song			
Aa3me.year() Retuns the year of the song			
Aa3me.trackNumber() Returns the track number of the song			
Aa3me.layer() Returns the Layer of the song. Eg 1,2 or 3					
Aa3me.kbit() Returns the Kilibit rate of the song					
Aa3me.mode() Returns the sound mode of the song. Eg MONO or STERIO			
Aa3me.rawSongTime() Returns the current time of the song in seconds				
Aa3me.instantBitrate() Retunrs the instant bit rate.			
Aa3me.visL() Needs a number between 1-> infinity and will return a value unique to the song playing. Left channel					
Aa3me.visR() Needs a number between 1-> infinity and will return a value unique to the song playing. Right Channel				
Aa3me.art() Requires a path for the saving of the Album art extracted from the song. Returns a 1 for a Jpg image and a 2 for a png image. 
		Eg isart = Aa3me.art("ms0:/Music/"..songname)
			if isart == 1 then
				albart = Image.load("ms0:/Music/"..artname..".jpg")
			end
			if isart == 2 then
				albart = Image.load("ms0:/Music/"..artname..".png")
			end							
Aa3me.setPos()	Sets the position of the mark for the song. 				
Aa3me.getPos()	Returns the current mark position of the song.	
Aa3me.info() Requires the path of the song. Allows the use of the ID3 functions except for kbit,hz,mode,songTime to be used with out loading a file.		s
###Controls Functions##### NOTE SAME AS LuaPlayer.
Controls.read()
Controls.select() 
Controls.start() 
Controls.up() 
Controls.right() 
Controls.down() 
Controls.left() 
Controls.l() 
Controls.r() 
Controls.triangle() 
Controls.circle() 
Controls.cross() 
Controls.square() 
Controls.home() 
Controls.hold() 
Controls.note() 
Controls.volup() 
Controls.voldown() 
Controls.screen() 
Controls.analogX() 
Controls.analogY() 
Controls.buttons() 
Controls.wlan() 

###Timer Functions##### NOTE SAME AS LuaPlayer.
Timer.new() 
Timer:start() 
Timer:time() 
Timer:stop() 
Timer:reset() 

###Wlan Functions#####
Wlan.init() Starts the Wlan and connects to a network.
Wlan.term() Ends the Wlan
Wlan.getIP() Returns the IP address or error.
Wlan.startGameShare() Requires a path to the file. Then starts the gameshare.

###Adhoc Functions#####
Adhoc.init() Starts the Adhoc.
Adhoc.connect() Requires a network name. Connects to that network/or hosts it.
Adhoc.getState() 1 for connected. 0 error.
Adhoc.send() Requires a string of data. 
Adhoc.recv() Returns either data as string or nul
Adhoc.term() End sthe Adhoc
Adhoc.getMac() Returns the mac address. Doen not need Adhoc to be started,

###socket Functions##### NOTE SAME AS LuaPlayer.
Socket.connect() 
Socket.createServerSocket() 
Socket.udpConnect() 
Socket.isConnected() 
Socket.accept() 
Socket.send() 
Socket.recv() 
Socket.close() 
Socket.udpRecv() 
Socket.udpSend() 

###screen Functions#####
screen.clear() Requires a color. Clears the screen        
screen.init() Starts the graphics. Not needed. Automaticly starts.
screen.print() Requires x,y,text,size,color,glow color. IT also take a 7th argumet of font number. 1->17. 17 is for Japaniese text.        
screen.save() Requires a path for the screenshot.		
screen.endDraw() Ends the drawing/3D engine.						
screen.startDraw() starts the drawing/3D engine.						
screen.syncDraw() Restarts the drawing/3D engine. 						
screen.flipscreen() Flips the screen buffer.						
screen.waitVblankStart() Waits for the PSP Vblank.
screen.toImage() Copies the screen. Just drawn between the screen.startDraw()/screen.endDraw() with out being fliped. And returns an image.
screen.bilinear() 1 enables, 0 disables.
screen.dither() 1 enables, 0 disables.
screen.transparentColor() Requires a color. That color will be transparent.					

###font Functions#####
Font.load() Requires a path to the ttf font and size. Returns a font.
Font.print() Requires font,x,y,text,color

###Image Functions#####
Image.load() Requires the path of an image and returns the image.
Image.createEmpty() Requires width and height value. Makes an empty image and returns the pointer.
Image.blit() Requiese a x,y,image. Draws an image to the screen.
	     Also can use Image.blit(x,y,img,x0,y0,x1,y1) or to draw to an image use Image.(dest img,x,y,img) or Image.blit(dest img,x,y,img,x0,y0,x1,y1)
Image.fillRect() Requies a x,y,width,height,color Draws a rectangle and colors it in.
		Also can use to draw to an image Image.fillRect(dest img,x,y,width,height,color)
Image.drawLine() Requires a x,y,x1,y1,color
		also can use to draw to an image Image.drawLine(dest img,x,y,x1,y1,color)
Image.setPixel() Requires a x,y,color
Image.getPixel() Requires a x,y and returns a color.
Image.width() Requires an image, returns the width
Image.height() Requires an image, returns the height
Image.resize() requires a new widht, height and image.
Image.rotate() requires a centering x,y,angle and image
Image.center() requires a new centering x,y and image
Image.reset() requires an image. Returns the image back to it's loaded specifications.
Image.creatSprite() requries x,y,width,height and image. returns a image of the inclosed area.	
Image.clear() Requires an image and color. Clears an image.
Image.swizzle() Requires an image
Image.unswizzle() Requires an image
Image.loadFromMemory() Requires rawimagedata. Returns an image from the data.
Image.toVRam() Requires an image. Moves the image to Vram. Faster drawing.
Image.toRam() Requires and image. Moves to the Ram. More strorage.

###Zip Functions#####
Zip.extract() Requires the path of the zip file and the extraction path.

###RAR Functions#####
RAR.extract() Requires the path of the rar file and the extraction path.


Thaks To everoy that contributes to LuaPlayerHM. 
